<%--
 *  File:    EmployeeSelect.jsp
 *  @Author: Langerwang 
 *  Date:    2001/11/29
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<%
  //init param
  Category cat = Category.getInstance("jsp.EmployeeSelect"); 
  String strTableName = "ovemployee";
  String strModuleName = "UPM";
%>



<% //--------------------------------------  include files list --%>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>EmployeeSelect</title>
<PageFlow:CheckPageFlow pageName="employeeselect"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%
  cat.debug("The strCurSearchName is :" + strCurSearchName);
  cat.debug("The strCurSearchValue is :" + strCurSearchValue);  
  cat.debug("The strCurOrderByCol is :" + strCurOrderByCol);
  cat.debug("The strCurOrderByType is :" + strCurOrderByType);
  cat.debug("The nCurMaxItem is :" + nCurMaxItem);  
  cat.debug("The nCurCount is :" + nCurCount);  
  cat.debug("The nCurPageNo is :" + nCurPageNo);
  cat.debug("The nCurTotalPage is :" + nCurTotalPage);
  cat.debug("The nCurEndIndex is :" + nCurEndIndex);
  cat.debug("The bCurHasPre is :" + bCurHasPre);
  cat.debug("The bCurHasNext is :" + bCurHasNext);          
  
  Vector employees = (Vector)pageContext.getAttribute("allemployee");
  if(employees == null)
  {
    employees = new Vector();
  }
  cat.debug("The employees is :" + employees);          
%>

<script>
function clickEmployee(id,name,mail)
{
  document.employeeselectform.employeeid.value = id;
  document.employeeselectform.employeename.value = name;
  document.employeeselectform.email.value =mail;
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(employeeselectform,actionvalue,orderbyname);
  editform.action = "EmployeeSelect.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}

function setParentValue()
{
  <%--[SCRIPT]  alert(document.employeeselectform.employeeid.value);  [SCRIPT]--%>
  <%--[SCRIPT]  alert(document.employeeselectform.employeename.value);  [SCRIPT]--%>
  if(document.employeeselectform.hasmail.value =="Y" || document.employeeselectform.hasmail.value =="y")
  {
      if(document.employeeselectform.employeeid.value != null && document.employeeselectform.employeeid.value != -1)
      {
        
        opener.page_setEmployee(document.employeeselectform.employeeid.value,document.employeeselectform.employeename.value,document.employeeselectform.email.value);
      } 
  }
  else
  {
    if(document.employeeselectform.employeeid.value != null && document.employeeselectform.employeeid.value != -1)
      {
        
        opener.page_setEmployee(document.employeeselectform.employeeid.value,document.employeeselectform.employeename.value);
      } 
  }   
  window.close();
}

</script>


<html>
<head>
<title>OpenSearchUser</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="employeeselectform" method="post">
    <input type="hidden" name="pagename" value="employeeselect">
    <input type="hidden" name="actionname">   
      
     <input type=hidden name=hasmail value='<%=JspHelper.filterNull(((request.getParameter("hasmail")==null)?"":(request.getParameter("hasmail"))))%>'>
  <table border="1" cellpadding="2" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" width="100%">
    <tr> 
      <td colspan="4"> 
        <table width="100%" cellspacing="0" cellpadding="0">
         <%@ include file="/inc/SummarySearch.inc" %>
        </table>
      </td>
    </tr>
    <tr> 
      <td height="20" width="25" class="deepblue-left">&nbsp;</td>
      <td height="20" width="100" class="deepblue-left">&nbsp;<a href="javascript:page_summary('orderby','employeecode')"><%= label.getLabelName("L_Employee") %></a></td>
      <td height="20" width="100" class="deepblue-left">&nbsp;<a href="javascript:page_summary('orderby','employeename')"><%= label.getLabelName("L_EmployeeName") %></a></td>
      <td height="20" class="deepblue-left">&nbsp;<a href="javascript:page_summary('orderby','deptname')"><%= label.getLabelName("L_Department") %></a></td>
    </tr>
     <%
        int i = 0;
        String strIsChecked = new String("Checked");
        String strClassType = new String();   
        Integer nEmployeeId = null;
        String strEmployeeName = ""; 
        String strEMail="";    
     %>
     <logic:iterate id="employee" collection="<%= employees %>"> 
     <%
       HashMap employeeMap = (HashMap)pageContext.getAttribute("employee"); 
       if(i%2 == 1)
       {
         strClassType = "td-listrom";
       }else{                    
         strClassType = "";
       }
       if(i != 0)
       {          
         strIsChecked = "";
       }
       else
       {
         nEmployeeId = (Integer)(employeeMap.get("employeeid"));
         strEmployeeName = (String)(employeeMap.get("employeename")); 
         strEMail=(String)(employeeMap.get("email"));        
       }  
       i++;        
     %>       
      <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"  onClick="javascript:radiotrue('selectEmployee<%=JspHelper.filterNull(i)%>');clickEmployee('<%=JspHelper.filterNull(employeeMap.get("employeeid"))%>','<%=JspHelper.filterNull(employeeMap.get("employeename"))%>','<oval:write name="employee" property="email"/>')" class="<%=JspHelper.filterNull(strClassType)%>">
      <td width="16"> 
        <input type="radio" id="selectEmployee<%=JspHelper.filterNull(i)%>" name="selectEmployee" value="<%=JspHelper.filterNull( employeeMap.get("employeeid") )%>" <%=JspHelper.filterNull( strIsChecked )%> class="normalradio" onClick="javascript:clickEmployee('<%=JspHelper.filterNull(employeeMap.get("employeeid"))%>','<%=JspHelper.filterNull(employeeMap.get("employeename"))%>','<oval:write name="employee" property="email"/>')">
      </td>
      <td width="86">&nbsp;<%=JspHelper.filterNull( employeeMap.get("employeecode") )%></td>
      <td width="91">&nbsp;<%=JspHelper.filterNull( employeeMap.get("employeename") )%></td>
      <td >&nbsp;<%=JspHelper.filterNull( employeeMap.get("deptname") )%></td>
    </tr>
    </logic:iterate> 
    <input type="hidden" name="employeeid" value="<%=JspHelper.filterNull( nEmployeeId )%>">
    <input type="hidden" name="employeename" value="<%=JspHelper.filterNull( strEmployeeName )%>">  
    <input type=hidden name="email" value="<%=JspHelper.filterNull(strEMail)%>">  
    <% //--------------------------------------  flipping page --%>
     <%@ include file="/inc/SummaryActionPop.inc" %>
    </table>
</form>
<table width="100%" cellspacing="0" cellpadding="0">
  <tr> 
    <td class="td_center"><a onclick="setParentValue()"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a></td>
  </tr>
</table>
</body>
</html>


